<template>
    <div class="login-wrapper">
        <div class="custom-topHr"></div>

        <div class="logo-box">
            <img class="logo" src="@/assets/images/logo1.png">
        </div>
        <div class="login-box">
            <customForm :type="type"/>

            <div class="submit-box">
                <button class="submit-btn" @click="bind_mobile">提 交</button>
            </div>
        </div>
    </div>
</template>

<script type="text/ecmascript-6">
    import customForm from "./form";
    import constant from "@/utils/constant.js";
    // 引用API文件
    import http from "@/utils/http.js";

    export default {
        name: "bindmobile",
        data() {
            return {
                type: "forgetpassword"
            };
        },
        components: {
            customForm
        },
        methods: {
            bind_mobile() {
                const reg = 11 && /^((13|14|15|17|18)[0-9]{1}\d{8})$/;
                let mobile = this.$store.state.loginform.mobile;
                if (mobile == "") {
                    this.$message({
                        message: "手机号不能为空",
                        type: "warning"
                    });
                    return;
                }
                if (!reg.test(mobile)) {
                    this.$message({
                        message: "请输入正确的手机号",
                        type: "warning"
                    });
                    return;
                }

                let sms_code = this.$store.state.loginform.sms_codef;

                if (sms_code == "") {
                    this.$message({
                        message: "请填写验证码",
                        type: "warning"
                    });
                    return;
                }

                console.log(sms_code);

                this.$router.push({
                    //核心语句
                    path: "/login/reset",
                    query:{mobile:mobile,sms_code:sms_code}
                });
            }
        }
    };
</script>

<style scoped lang="scss">
</style>
